<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <title>转播市场</title> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/staticRep/layui/css/layui.css?cdnv=0.16"> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/staticRep/css/le-main1.css?cdnv=0.16"> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/staticRep/css/alliance-market.css?cdnv=0.16"> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/staticRep/font-awesome-4.7.0/css/font-awesome.min.css?cdnv=0.16"> 
  <style type="text/css">
        .select_sidebar_child{
            background-color: #2D93CA;
        }
    </style> 
 </head> 
 <body> 
  <div class="le-main"> 
   <div class="le-head"> 
    <div class="le-head-content"> 
     <div class="le-head-logo">
      <a href="#"><img src="http://cdn.lezhibo.com/staticPortal/portal/img/lelive-logo1.jpg"></a>
     </div> 
     <div class="le-head-nav"> 
      <ul class="layui-nav le-nav"> 
       <li class="layui-nav-item" id="nav-index"><a href="/portal">直播活动</a></li> 
       <li class="layui-nav-item" id="nav-videoClip"><a href="http://www.lezhibo.com/videoClip/portal">小视频</a></li> 
       <li class="layui-nav-item" id="nav-mcloud"><a href="/portal/mediacloud">媒体云</a></li> 
       <li class="layui-nav-item" id="nav-shop"><a href="/portal/shop">商城</a></li> 
       <li class="layui-nav-item" id="nav-device"><a href="/portal/device">硬件设备</a></li> 
       <li class="layui-nav-item" id="nav-liveroom"><a href="/portal/liveroom/info?id=d9c6afa2e0b649afbd56d3c10e6ffc3d">直播间</a></li> 
       <li class="layui-nav-item layui-this"><a href="/portal/publish">联盟市场</a></li> 
      </ul> 
     </div> 
     <div class="le-head-personal" style="width: 10%"> 
      <ul class="le-head-icon"> 
       <li class="le-head-icon-bell"> <a href="/portal/center/message"> <i class="fa fa-bell fa-lg" aria-hidden="true"></i> </a> <span class="bell-mark"><i class="fa fa-circle" aria-hidden="true"></i></span> </li> 
       <!--<li><a href=""><i class="fa fa-server fa-lg" aria-hidden="true"></i></a></li>
                <li><a href="http://www.lezhibo.com/portal/center"><i class="fa fa-user-circle fa-lg" aria-hidden="true"></i></a></li>--> 
       <li><a href="/portal/center"> <img src="http://cdn.lezhibo.com/staticPortal/portal/img/avatar.jpg"> </a></li> 
      </ul> 
     </div> 
    </div> 
   </div> 
   <div class="le-content-wrap le-head-content"> 
    <div class="le-sidebar"> 
     <ul class="layui-nav layui-nav-tree"> 
      <li class="layui-nav-item" id="market"> <a href="javascript:void(0);" onclick="setItem()"><i class="fa fa-clock-o" aria-hidden="true"></i>&nbsp;发行</a> 
       <dl class="layui-nav-child"> 
        <dd id="publishMarket">
         <a href="/portal/publish">发行市场</a>
        </dd> 
        <dd id="reproduceMarket">
         <a href="/reproduce/portal">转播市场</a>
        </dd> 
       </dl> </li> 
      <li class="layui-nav-item" id="mine"> <a href="javascript:void(0);" onclick="setItem()"><i class="fa fa-user-plus" aria-hidden="true"></i>&nbsp;我的</a> 
       <dl class="layui-nav-child"> 
        <dd id="myPublish">
         <a href="/portal/publish/put">我的发行</a>
        </dd> 
        <dd id="myReproduce">
         <a href="/reproduce/portal/myApplyReproduce">我的转播</a>
        </dd> 
       </dl> </li> 
     </ul> 
    </div> 
    <div class="le-content"> 
     <div class="le-mall-content"> 
      <div> 
       <a href="javascript:void(0);" layer-href="/reproduce/portal/publishActivity"><button class="layui-btn">发布转播</button></a> 
       <a href="/reproduce/portal/myPublishActivity" class="color-default">我发布的转播</a> 
      </div> 
      <div class="le-more mr2"> 
       <ul class="ul-filter fix"> 
        <li>类型：</li> 
        <li><a href="javascript:addCategory('111');" class="le-red">不限</a></li> 
        <li><a href="javascript:addCategory('1');">亲子</a></li> 
        <li><a href="javascript:addCategory('10');">婚庆</a></li> 
        <li><a href="javascript:addCategory('2');">体育</a></li> 
        <li><a href="javascript:addCategory('3');">教育</a></li> 
        <li><a href="javascript:addCategory('4');">文艺</a></li> 
        <li><a href="javascript:addCategory('5');">科幻</a></li> 
        <li><a href="javascript:addCategory('6');">房地产</a></li> 
        <li><a href="javascript:addCategory('7');">汽车</a></li> 
        <li><a href="javascript:addCategory('8');">美食</a></li> 
        <li><a href="javascript:addCategory('9');">旅游</a></li> 
       </ul> 
       <ul class="ul-filter fix"> 
        <li>价格：</li> 
        <li><a href="javascript:addPriceRange('0');" class="le-red">不限</a></li> 
        <li><a href="javascript:addPriceRange('0-100');">1-100元</a></li> 
        <li><a href="javascript:addPriceRange('100-1000');">100-1000元</a></li> 
        <li><a href="javascript:addPriceRange('1000-');">1000元以上</a></li> 
       </ul> 
       <ul class="ul-filter fix"> 
        <li>地区：</li> 
        <li><a href="javascript:addCity('不限');" class="le-red">不限</a></li> 
        <li><a href="javascript:addCity('北京');">北京</a></li> 
        <li><a href="javascript:addCity('上海');">上海</a></li> 
        <li><a href="javascript:addCity('广州');">广州</a></li> 
        <li><a href="javascript:addCity('深圳');">深圳</a></li> 
        <li><a href="javascript:addCity('天津');">天津</a></li> 
        <li><a href="javascript:addCity('重庆');">重庆</a></li> 
        <li><a href="javascript:addCity('其他');">其他</a></li> 
       </ul> 
      </div> 
      <form id="repMarketForm" role="form" class="form-inline pull-right lzb-guide-search" method="get" action="/reproduce/portal/reproduceMarket"> 
      </form> 
      <ul class="le-hardware-content"> 
       <li layer-href="/reproduce/portal/applyReproduce?id=a17391147f2349bda0bec640d87a8b83"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/attachment/20170822/12dd9992d24c4a7a9d4bad887a45d42b.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">“善林金融“2017中国足球协会业余联赛大区赛（淄博赛区）决赛 淄博星期天VS青岛康太源</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥0.00</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=f5303a715abc45748d44361eb5e17bab"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/staticRep/img/activity-default.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">禾苗N8直播机进驻8月23日北京广电展</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥0.00</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=5f5d1ac5c9de44988d59bf97f7f58355"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/attachment/20170815/226d4de3ee6749139d4357de438875d8.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">喜马拉雅-小雅音响上市发布会直播</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥1.00</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=543cc986466b4110ae3616533e912d1c"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/staticRep/img/activity-default.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">第七届中国国际少儿车模大赛惠州赛区</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥0.01</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=9eb1130af7064692bf638a57ea3f4c4b"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/staticRep/img/activity-default.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">璀璨之夜瑞芙臣群星演唱会</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥0.10</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=7f97fb2ef50448288f480d68177a205e"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/attachment/20170817/da8e75564ab64e50b2a917be4dd3981d.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">『重磅直播』8.20大动作&amp;涡阳群星演唱会</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥0.10</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=d0e46833f0014f8ea9f9f04c572ba513"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/staticRep/img/activity-default.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">全球直播！红动819惠达免单日群星闪耀堪比春晚</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥1.00</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=7a9846104a344a56a2462488e65d757d"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/attachment/20170702/c07e9bcaaee144dcb3a641e7b351cc14.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">时不我待，全新BMW 5系宁波上市发布直播ing……</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥20.00</p> 
        </div> </li> 
       <li layer-href="/reproduce/portal/applyReproduce?id=4a5c148f28624431a258a395b6d2854d"> 
        <div class="le-loud-img"> 
         <img src="http://cdn.lezhibo.com/attachment/20170802/2ebc84a0e4604b738da59cceee3681ed.jpg" style="width:100%;"> 
        </div> 
        <div class="le-loud-describe"> 
         <h2 style="width:65%;">菲律宾达沃私人海岛游直播中</h2> 
         <p style="width:35%;padding-right:5px;box-sizing: border-box;">￥200.00</p> 
        </div> </li> 
      </ul> 
      <div class="le-pages"> 
       <a href="javascript:;" class="previous disabled">上一页</a> 
       <a href="javascript:;" class="active">1</a> 
       <a href="/reproduce/portal?p=reproduceMarket&amp;page=2" class="">2</a> 
       <a href="/reproduce/portal?p=reproduceMarket&amp;page=3" class="">3</a> 
       <a href="/reproduce/portal?p=reproduceMarket&amp;page=4" class="">4</a> 
       <a href="/reproduce/portal?p=reproduceMarket&amp;page=5" class="">5</a> 
       <a href="/reproduce/portal?p=reproduceMarket&amp;page=2" class="next">下一页</a> 
      </div> 
      <div class="clearfix"></div> 
      <div class="le-footer"> 
       <p>Copyright © 2015-2016 le.com.cn. All rights reserved.</p> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/layui/layui.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/layui/lay/dest/layui.all.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/js/jquery.min.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/js/jquery.form.min.js?cdnv=0.16"></script> 
  <script>
        var cdnPath="http://cdn.lezhibo.com";//cdn路径
        var globalNeedRefreshIndex = "";
        var globalNeedRefreshUrl = "";
        var needRefresh = false;

        function openLayer(url, title, func, isNeedRefreshThisPage) {
            var index = layer.open({
                type: 2,
                title: title,
                shadeClose: true,
                shade: 0.6,
                area: ['60%', '80%'],
                content: url,
                end: function () {
                    location.reload();
                }
            });

            if (isNeedRefreshThisPage == true) {
                globalNeedRefreshIndex = index;
                globalNeedRefreshUrl = url;
            }

        }

        function layerInit() {
            $("[layer-href]").click(function () {
                if ("" == $(this).attr("layer-need-record")) {
                    openLayer($(this).attr("layer-href"), $(this).attr("layer-title"), $(this).attr("layer-func"), true);
                } else {
                    openLayer($(this).attr("layer-href"), $(this).attr("layer-title"), $(this).attr("layer-func"), false);
                }
            });

            $("[go-href]").click(function () {
                var href = $(this).attr("go-href");
                var newWind = $(this).attr("go-href-new");
                if (newWind == "true") {
                    window.open(href);
                } else {
                    window.location.href = href;
                }
            });


            $("[confirm-href]").click(function () {
                var href = $(this).attr("confirm-href");
                if ((typeof(href) == "undefined") || href == null || href == "") {
                    return;
                }

                var title = $(this).attr("confirm-title");
                if ((typeof(title) == "undefined") || title == null || title == "") {
                    title = "您确定执行该操作吗？"
                }
                //是否删除页面Tr 以避免刷新丢失未保存的其他信息
                var isRemoveTr = $(this).attr("isRemoveTr");
                var tr = $($(this).parents("tr")[0]);
                layer.confirm(title, {icon: 9, title: '确定操作'}, function (index) {
                            layer.close(index);
                            $.get(href, function (result) {
                                if (result.isOk) {
                                    if(isRemoveTr=="yes") {
                                        tr.remove();
                                        return;
                                    }
                                    location.reload();
                                } else {
                                    alert(result.message);
                                }
                            });
                        },
                        function (index) {
                            layer.close(index);
                        });
            });


        }

        function headerFocus() {
            $("#nav-alliance").addClass("layui-this");
        }


        /*function initSidebarUrls() {

            $(".le-sidebar").find(".layui-nav-item").each(function () {
                var pid = $(this).attr("id");
                if (typeof(pid) == 'undefined' || null == pid) {
                    return;
                }

                var href = $(this).children('a').attr("href");
                if ((typeof(href) != "undefined") && href.indexOf("?") == -1) {
                    href = href + "?p=" + pid;
                } else {
                    href = href + "&p=" + pid;
                }
                $(this).attr("class", "layui-nav-item");
                $(this).children('a').attr("href", href);
            });

            $("#market").attr("class", "layui-nav-item layui-this");
        }*/
        function initSidebarUrls() {
            $(".le-sidebar").find("dd").each(function () {
                var pid = $(this).attr("id");
                if (typeof(pid) == 'undefined' || null == pid) {
                    return;
                }
                var href = $(this).children('a').attr("href");
                if ((typeof(href) != "undefined") && href.indexOf("?") == -1) {
                    href = href + "?p=" + pid;
                } else {
                    href = href + "&p=" + pid;
                }
                $(this).children('a').attr("href", href);
            });

            $("#reproduceMarket").attr("class", "layui-this");
            $("#market").attr("class", "layui-nav-item layui-nav-itemed ");
        }

        function setItem(){

            $(this).parent(".layui-nav-item").attr("class","layui-nav-item layui-nav-itemd");
        }

        var verification = {
            mobiel: function () {
                $mobile = $("input[validate='mobile']").val();
                var re = /^1\d{10}$/;
                if ((typeof($mobile) != "undefined") && !re.test($mobile)) {
                    $("input[validate='mobile']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入正确的手机号</span></p>');
                    return false;
                }
            },
            email: function () {
                $email = $("input[validate='email']").val();
                var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                if ((typeof($email) != "undefined") && !re.test($email)) {
                    $("input[validate='email']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入正确的邮箱</span></p>');
                    return false;
                }
            },
            empty: function () {
                var $input = $("input[validate='empty']");
                for (var i = 0; i < $input.length; i++) {
                    if ($input.eq(i).val().trim().length == 0) {
                        $("input[validate='empty']").eq(i).after('<p class="le-tips"><span style="color: red;width: 100%">输入不能为空</span></p>');
                        return false;
                    }
                }

                var $textarea =$("textarea[validate='empty']");
                for(var i=0;i<$textarea.length;i++){
                    if($textarea.eq(i).val().trim().length==0){
                        $("textarea[validate='empty']").eq(i).after('<p class="le-tips"><span style="color: red;width: 100%">输入不能为空</span></p>');
                        return false;
                    }
                }
            },

            password: function () {
                $password = $("input[validate='password']").val();
                var re = /(.+){6,12}$/;
                if ((typeof($password) != "undefined") && !re.test($password)) {
                    $("input[validate='password']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入6到12位密码</span></p>');
                    return false;
                }
            },
            decimal: function (value) {
                $decimal = $("input[validate='decimal']");
                var re = /^[0-9]+\.{0,1}[0-9]{0,2}$/;
                for (var i = 0; i < $decimal.length; i++) {
                    var every=$decimal.eq(i).val().trim();
                    if ((typeof(every) != "undefined") && !re.test(every)) {
                        $("input[validate='decimal']").eq(i).after('<p class="le-tips"><span style="color: red">值不能小于0</span></p>');
                        return false;
                    }
                }
            }
        };


        var regularVerify = {
            mobile: function (value) {
                var re = /^1\d{10}$/;
                if ((typeof(value) != "undefined") && !re.test(value)) {
                    return false;
                }
            },
            email: function (value) {
                var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                if ((typeof(value) != "undefined") && !re.test(value)) {
                    return false;
                }
            },
            password: function (value) {
                var re = /(.+){6,12}$/;
                if ((typeof(value) != "undefined") && !re.test(value)) {
                    return false;
                }
            },
            integer: function (value)     {
//                    var re = /^[1-9]\d*$/;
                var re = /^\d+$/;
                if ((typeof(value) != "undefined") && !re.test(value)) {
                    return false;
                }
            },
            decimal: function (value) {
//                    var re = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/;
                var re = /^[0-9]+\.{0,1}[0-9]{0,2}$/;
                if ((typeof(value) != "undefined") && !re.test(value)) {
                    return false;
                }
            },
            empty: function (value) {
                if (value.trim().length == 0) {
                    return false;
                }
            }
        }


        function leSubmit() {
            $("[le-submit]").click(function () {
                var $form = $(this).parents("form");
                var sfunc = $form.attr("success-func");
                var bfunc = $form.attr("before-func");
                $form.ajaxSubmit({
                    type: "post",
                    dataType: "json",
                    beforeSend: function () {
                        if(bfunc != null){
                            if(false == eval(bfunc)){
                                return false;
                            }
                        }
                        $(".le-tips").remove();
                        if (false == verification.empty()) {
                            return false;
                        }
                        if (false == verification.mobiel()) {
                            return false;
                        }
                        if (false == verification.email()) {
                            return false;
                        }
                        if (false == verification.password()) {
                            return false;
                        }
                    },
                    success: function (result) {
                        if (sfunc != null) {
                            eval(sfunc);
                            return;
                        }

                        if (result.isOk) {
                            parent.isUpdateData = true;
                            parent.layer.closeAll();
                        } else {
                            alert(result.message);
                        }
                    },
                    error: function () {
                        alert("信息提交错误");
                    }
                });
            })
        }

        //对日期选择范围的控制
        //对id为begin-date和end-date的日期选择控件进行控制
        function verifyDate() {
            layui.use('laydate', function () {
                var laydate = layui.laydate;
                var start = {
                    min: '2006-01-01 00:00:00',
                    max: '2099-06-16 23:59:59',
                    istoday: false,
                    choose: function (datas) {
                        end.min = datas;    //开始日选好后， 重置结束日的最小日期
                        end.start = datas;  //将结束日的初始值设定为开始日
                    }
                };

                var end = {
                    min: '2006-01-01 00:00:00',
                    max: '2099-06-16 23:59:59',
                    istoday: false,
                    choose: function (datas) {
                        start.max = datas;  //结束日选好后, 重置开始日的最大日期
                    }
                };

                $('.begin-date').click(function () {
                    start.elem = this;
                    laydate(start);
                });
                $('.end-date').click(function () {
                    end.elem = this;
                    laydate(end);
                });

            });
        }

        layui.use('element', function(){
            var element = layui.element(); //Tab的切换功能，切换事件监听等，需要依赖element模块
        });
        //    最小高度控制
        function fix() {
            var head_height = $('.le-head').outerHeight();
            var window_height = $(window).height();
            var content_height = $('.le-content').outerHeight();
            var sidebar_height = $(".le-sidebar").height();

            if(content_height < (window_height - head_height)){
                $(".le-content").css('min-height', (window_height - head_height));
            }else{
                $(".le-sidebar").css('min-height', content_height);
                sidebar_height = content_height;
            }

            if(sidebar_height < (window_height - head_height)){
                $(".le-sidebar").css('min-height', (window_height - head_height));
            }


        }
        fix();
        layerInit();
        headerFocus();
        initSidebarUrls();
        leSubmit();
        verifyDate();
//<script>

    function initSelect(){
        var categoryId = "111";
        var priceRange = "0";
        var cityName = "不限";
        $("#repMarketForm").append("<input  name='categoryId' value='"+categoryId+"'  class='form-control' type='hidden'>");
        $("#repMarketForm").append("<input  name='priceRange' value='"+priceRange+"'  class='form-control' type='hidden'>");
        $("#repMarketForm").append("<input  name='cityName' value='"+cityName+"'  class='form-control' type='hidden'>");
    }
    function addPriceRange(data){
        $("input[name='priceRange']").remove();
        $(this).siblings("li").removeClass("le-red");
        $(this).addClass("le-red");
        $("#repMarketForm").append("<input  name='priceRange' value='"+data+"'  class='form-control' type='hidden'>");
        $("#repMarketForm").submit();
    }
    function addCity(data){
        $("input[name='cityName']").remove();
        $(this).siblings("li").removeClass("le-red");
        $(this).addClass("le-red");
        $("#repMarketForm").append("<input  name='cityName' value='"+data+"'  class='form-control' type='hidden'>");
        $("#repMarketForm").submit();
    }
    function addCategory(data){
        $("input[name='categoryId']").remove();
        $(this).siblings("li").removeClass("le-red");
        $(this).addClass("le-red");
        $("#repMarketForm").append("<input  name='categoryId' value='"+data+"'  class='form-control' type='hidden'>");
        $("#repMarketForm").submit();
    }
    initSelect();
//</script>    
 </body>
</html>